/*
 * This file is part of FinVis.
 *
 * FinVis is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * FinVis is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with FinVis.  If not, see <http://www.gnu.org/licenses/>
 *
 * @author Stephen Rudolph
 */
#include "Common.h"
#include "FinSettings.h"
#include <QFile>
#include <QSettings>

FinSettings::FinSettings(QObject *parent) :
    QObject(parent)
{
    QSettings settings(CONFIG_FILE, QSettings::IniFormat);
    QString configDisplayType = settings.value("DisplayType", "Default_View").toString();
    settings.setValue("DisplayType", configDisplayType);
    if (configDisplayType.toLower() == "default_view")
    {
        this->m_displayType = FinView::DEFAULT_VIEW;
    }
    else if (configDisplayType.toLower() == "table_view")
    {
        this->m_displayType = FinView::TABLE_VIEW;
    }
    else if (configDisplayType.toLower() == "simple_view")
    {
        this->m_displayType = FinView::SIMPLE_VIEW;
    }
    else if (configDisplayType.toLower() == "optimistic_only")
    {
        this->m_displayType = FinView::OPTIMISTIC_ONLY;
    }
    else if (configDisplayType.toLower() == "pessimistic_only")
    {
        this->m_displayType = FinView::PESSIMISTIC_ONLY;
    }
}

enum FinView::display FinSettings::getDisplayType()
{
    return this->m_displayType;
}
